package com.qida.clm.core.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;

/**
 * Created by edgar on 2016/1/28.
 */
public class DbManager {
    private static BaseSQLiteOpenHelper sSQLiteOpenHelper;

    public static void initSQLiteDataBase(Context context,String dbName,SQLiteDatabase.CursorFactory factory,int dbVersion,
                                          ISQLiteOpenHelper isqLiteOpenHelper){
        sSQLiteOpenHelper = new BaseSQLiteOpenHelper(context,dbName,
                factory,dbVersion,isqLiteOpenHelper);
    }

    public static OrmLiteSqliteOpenHelper getORMSQLiteOpenHelper(){
        if(sSQLiteOpenHelper == null){
            throw new NullPointerException("请先调用initSQLiteDataBase方法");
        }
        return sSQLiteOpenHelper;
    }
}